package com.orhon.smartcampus.modules.material.mm;


import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.base.mm.SchoolMapper;
import com.orhon.smartcampus.modules.material.entity.Site;
import com.orhon.smartcampus.modules.material.gqlModel.GQLSite;

@Mapper(
        uses = {
                LangMapper.class,
                CampusMapper.class,
                SchoolMapper.class
        }
)
public interface SiteMapper {


    SiteMapper MAPPER = Mappers.getMapper(SiteMapper.class);


    @Mapping(source = "id" , target = "id")
    @Mapping(source = "siteUse" , target = "site_use")
    @Mapping(source = "siteArea" , target = "area")
    @Mapping(source = "siteRightUse" , target = "right_of_use")
    @Mapping(source = "siteTel" , target = "tel")
    @Mapping(source = "siteName" , target = "name")
    @Mapping(source = "siteManager" , target = "manager")   
    @Mapping(ignore = true, target = "campus" )
    @Mapping(ignore = true, target = "school" )
    @Mapping(source = "createdAt" , target = "created_at")
    @Mapping(source = "updatedAt" , target = "updated_at")
    GQLSite toSite(Site entity);
    
    @InheritConfiguration(name = "toSite")
    List<GQLSite> toSiteList(List<Site> entities);
}
